//
//  MKSecondTableViewCell.m
//  ManKeCartoon
//
//  Created by dllo on 15/10/16.
//  Copyright © 2015年 ManKe. All rights reserved.
//

#import "MKSecondTableViewCell.h"
#import "MKBaseHeader.h"
@implementation MKSecondTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    

    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        

        self.leftImage = [[UIImageView alloc] initWithFrame:CGRectMake(10 + 0 % 3 *( SCREEN_WIDTH / 3 - 5),  0 / 3 * (SCREEN_HEIGHT / 5  + 60)+ 5 , SCREEN_WIDTH / 3 - 15, SCREEN_HEIGHT / 5 + 20)];
        self.midImage = [[UIImageView alloc] initWithFrame:CGRectMake(10 + 1 % 3 *( SCREEN_WIDTH / 3 - 5),  1 / 3 * (SCREEN_HEIGHT / 5  + 60)+ 5 , SCREEN_WIDTH / 3 - 15, SCREEN_HEIGHT / 5 + 20)];
        
        self.rightImage = [[UIImageView alloc] initWithFrame:CGRectMake(10 + 2 % 3 *( SCREEN_WIDTH / 3 - 5),  2 / 3 * (SCREEN_HEIGHT / 5  + 60)+ 5 , SCREEN_WIDTH / 3 - 15, SCREEN_HEIGHT / 5 + 20)];
        
        

        self.leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
        self.midButton = [UIButton buttonWithType:UIButtonTypeCustom];
        self.rightButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [self.leftButton setFrame:CGRectMake(10 + 0 % 3 *( SCREEN_WIDTH / 3 - 5),  0 / 3 * (SCREEN_HEIGHT / 5  + 60) + 5 , SCREEN_WIDTH / 3 - 15, SCREEN_HEIGHT / 5 + 20)];
        [self.midButton setFrame:CGRectMake(10 + 1 % 3 *( SCREEN_WIDTH / 3 - 5),  1 / 3 * (SCREEN_HEIGHT / 5  + 60) + 5 , SCREEN_WIDTH / 3 - 15, SCREEN_HEIGHT / 5 + 20)];
        [self.rightButton setFrame:CGRectMake(10 + 2 % 3 *( SCREEN_WIDTH / 3 - 5),  2 / 3 * (SCREEN_HEIGHT / 5  + 60) + 5 , SCREEN_WIDTH / 3 - 15, SCREEN_HEIGHT / 5 + 20)];

        
        
        [self.contentView addSubview:self.leftButton];
        [self.contentView addSubview:self.midButton];
        [self.contentView addSubview:self.rightButton];
        

        [self.contentView addSubview:self.leftImage];
        [self.contentView addSubview:self.midImage];
        [self.contentView addSubview:self.rightImage];
            
        self.leftTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.leftImage.frame.origin.x, self.leftImage.frame.size.height + self.leftImage.frame.origin.y , self.leftImage.frame.size.width, 20)];
        self.midTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.midImage.frame.origin.x, self.midImage.frame.size.height + self.midImage.frame.origin.y , self.midImage.frame.size.width, 20)];
        self.rightTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.rightImage.frame.origin.x, self.rightImage.frame.size.height + self.rightImage.frame.origin.y , self.rightImage.frame.size.width, 20)];
        

        [self.leftTitleLabel setFont:[UIFont systemFontOfSize:15.]];
        [self.midTitleLabel setFont:[UIFont systemFontOfSize:15.]];
        [self.rightTitleLabel setFont:[UIFont systemFontOfSize:15.]];
        
        [self.leftTitleLabel setTextColor:[UIColor blackColor]];
        [self.midTitleLabel setTextColor:[UIColor blackColor]];
        [self.rightTitleLabel setTextColor:[UIColor blackColor]];
        
        
        [self.contentView addSubview:self.leftTitleLabel];
        [self.contentView addSubview:self.midTitleLabel];
        [self.contentView addSubview:self.rightTitleLabel];
            
        self.leftTypeLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.leftTitleLabel.frame.origin.x, self.leftTitleLabel.frame.size.height + self.leftTitleLabel.frame.origin.y , self.leftTitleLabel.frame.size.width, 15)];
        self.midTypeLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.midTitleLabel.frame.origin.x, self.midTitleLabel.frame.size.height + self.midTitleLabel.frame.origin.y , self.midTitleLabel.frame.size.width, 15)];
        self.rightTypeLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.rightTitleLabel.frame.origin.x, self.rightTitleLabel.frame.size.height + self.rightTitleLabel.frame.origin.y , self.rightTitleLabel.frame.size.width, 15)];
        

        [self.leftTypeLabel setTextColor:[UIColor grayColor]];
        [self.midTypeLabel setTextColor:[UIColor grayColor]];
        [self.rightTypeLabel setTextColor:[UIColor grayColor]];
        
        [self.leftTypeLabel setFont:[UIFont systemFontOfSize:12]];
        [self.midTypeLabel setFont:[UIFont systemFontOfSize:12]];
        [self.rightTypeLabel setFont:[UIFont systemFontOfSize:12]];
        
        [self.contentView addSubview:self.leftTypeLabel];
        [self.contentView addSubview:self.midTypeLabel];
        [self.contentView addSubview:self.rightTypeLabel];
            
  
    }
    return self;
}

- (void)getDataWithModel:(NSMutableArray *)firstModelArray{
    
    
    if (firstModelArray.count != 0) {
        
    
    MKFirstModel *firstModel = [firstModelArray objectAtIndex:0];
    MKFirstModel *secondModel = [firstModelArray objectAtIndex:1];
    MKFirstModel *thirdModel = [firstModelArray objectAtIndex:2];
    
    [self.leftImage sd_setImageWithURL:[NSURL URLWithString:firstModel.cover_url]];
    [self.midImage sd_setImageWithURL:[NSURL URLWithString:secondModel.cover_url]];
    [self.rightImage sd_setImageWithURL:[NSURL URLWithString:thirdModel.cover_url]];
    
    


//        if (index == 1) {
//            
//            self.topButton.tag = 100 + i + [self.myMUtableArray[0] count];
//        } else if (index == 3) {
//            
//            self.topButton.tag = 100 + i + [self.myMUtableArray[0] count] + [self.myMUtableArray[1] count] + [self.myMUtableArray[2] count];
//            
//        } else if (index == 4) {
//            
//            self.topButton.tag = 100 + i + [self.myMUtableArray[0] count] + [self.myMUtableArray[1] count] + [self.myMUtableArray[2] count] + [self.myMUtableArray[3] count];
//            
//        }

        

        [self.leftTitleLabel setText:firstModel.title];
        [self.midTitleLabel setText:secondModel.title];
        [self.rightTitleLabel setText:thirdModel.title];

        [self.leftTypeLabel setText:firstModel.meta_info];
        [self.midTypeLabel setText:secondModel.meta_info];
        [self.rightTypeLabel setText:thirdModel.meta_info];
    
    
    }
    
}






- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
